/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef HMFS_MKFS_COMMAND_H
#define HMFS_MKFS_COMMAND_H

#include <string>
#include <sys/types.h>
#include "hmfs_command.h"

namespace OHOS {
namespace Hmfs {

class MkfsCmdParser : public CmdParser {
public:
    ~MkfsCmdParser() = default;

    static MkfsCmdParser& GetInstance()
    {
        static MkfsCmdParser instance;
        return instance;
    }
    int32_t Parse(int32_t argc, char *argv[]);

private:
    MkfsCmdParser();
    MkfsCmdParser(const MkfsCmdParser&) = delete;
    MkfsCmdParser& operator=(const MkfsCmdParser&) = delete;
    void ConfigOptionPacket(void);
    void ConfigDefaultOption(void);
    bool CheckOptions(void);
    void ShowCmdInfo(void);
    void ShowCmdUsage(void);
    ArgParseResult ProcessHeapBasedAlloc(const std::string& argValue);
    ArgParseResult ShowVersion(const std::string& argValue);
    ArgParseResult ProcessDeviceList(const std::string& argValue);
    ArgParseResult ProcessColdFileExt(const std::string& argValue);
    ArgParseResult ProcessHotFileExt(const std::string& argValue);
    ArgParseResult ProcessForceOverwrite(const std::string& argValue);
    ArgParseResult ProcessDefaultOptionSet(const std::string& argValue);
    ArgParseResult ProcessHelp(const std::string& argValue);
    ArgParseResult ProcessVolumeLabel(const std::string& argValue);
    ArgParseResult ProcessZonedMode(const std::string& argValue);
    ArgParseResult ProcessQuietMode(const std::string& argValue);
    ArgParseResult ProcessSrandSeed(const std::string& argValue);
    ArgParseResult ProcessRootOwner(const std::string& argValue);
    ArgParseResult ProcessSegsPerSection(const std::string& argValue);
    ArgParseResult ProcessSparseMode(const std::string& argValue);
    ArgParseResult ProcessDiscardPolicy(const std::string& argValue);
    ArgParseResult ProcessTimestamp(const std::string& argValue);
    ArgParseResult ProcessUuid(const std::string& argValue);
    ArgParseResult ProcessWantedSectorSize(const std::string& argValue);
    ArgParseResult ProcessSectionsPerZone(const std::string& argValue);

    CmdConfig cmdPara_;
};

} // namespace Hmfs
} // namespace OHOS
#endif
